<template>
  <div class="block text-center">
    <span class="demonstration"> 轮播图 </span>
    <el-carousel height="500px">
      <el-carousel-item v-for="(item, index) in list" :key="index">
        <el-image :src="item.imageUrl" style="width: 100%; height: 500px" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
<script lang="ts" setup>
import { onMounted, reactive, ref } from 'vue'
import { fetchList, remove } from '@/apis/banner'

const list = ref<Array<any>>([])

const fetchData = () => {
  fetchList({}).then((response) => {
    let { code, message, result } = response.data

    list.value = result.items
    // console.log(result.items)
  })
}

onMounted(() => {
  fetchData()
})
</script>

<style scoped>
.demonstration {
  color: var(--el-text-color-secondary);
}

.el-carousel__item h3 {
  color: #475669;
  opacity: 0.75;
  line-height: 150px;
  margin: 0;
  text-align: center;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
</style>
